package com.acwing.partition12;

import java.io.*;

/**
 * @author `RKC`
 * @date 2022/2/9 15:16
 */
public class AC1184欧拉回路 {

    private static final int N = 100010, M = 400010;
    private static int[] head = new int[N], ver = new int[M], next = new int[M];
    private static boolean[] used = new boolean[M];

    private static int[] din = new int[N], dout = new int[N], ans = new int[M];

    private static int n = 0, m = 0, idx = 0, type = -1, cnt = 0;

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        type = Integer.parseInt(reader.readLine());
        String[] ss = reader.readLine().split(" ");
        n = Integer.parseInt(ss[0]);
        m = Integer.parseInt(ss[1]);
        for (int i = 0; i < N; i++) head[i] = -1;
        for (int i = 0; i < m; i++) {
            ss = reader.readLine().split(" ");
            int a = Integer.parseInt(ss[0]), b = Integer.parseInt(ss[1]);
            add(a, b);
            if (type == 1) add(b, a);
            din[b]++;
            dout[a]++;
        }
        if (type == 1) {
            //无向图欧拉回路的充要条件：度数为奇数的点只能有0个
            for (int i = 1; i <= n; i++) {
                if (((din[i] + dout[i]) & 1) == 1) {
                    writer.write("NO\n");
                    writer.flush();
                    return;
                }
            }
        } else {
            //有向图欧拉回路充要条件：所有点的出度等于入度
            for (int i = 1; i <= n; i++) {
                if (din[i] != dout[i]) {
                    writer.write("NO\n");
                    writer.flush();
                    return;
                }
            }
        }
        for (int i = 1; i <= n; i++) {
            if (head[i] != -1) {
                dfs(i);
                break;
            }
        }
        if (cnt < m) {
            writer.write("NO\n");
        } else {
            writer.write("YES\n");
            for (int i = cnt; i > 0; i--) writer.write(ans[i] + " ");
            writer.write("\n");
        }
        writer.flush();
    }

    private static void dfs(int u) {
        //遍历一条边就删一条边
        for (int i = head[u]; i != -1; i = head[u]) {
            if (used[i]) {
                head[u] = next[i];
                continue;
            }
            used[i] = true;
            if (type == 1) used[i ^ 1] = true;
            int t = -1;
            if (type == 1) {
                t = i / 2 + 1;
                if ((i & 1) == 1) t = -t;
            } else t = i + 1;
            head[u] = next[i];
            dfs(ver[i]);
            ans[++cnt] = t;
        }
    }

    private static void add(int a, int b) {
        ver[idx] = b;
        next[idx] = head[a];
        head[a] = idx++;
    }
}
